home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 1.iso
/
ARGONET
/
PD
/
FILER
/
FSCK131.SPK
/
hard_help
< prev
next >
Wrap
Text File
|
1996-12-22
|
13KB
|
331 lines
hardfix (1.11) - heavily damaged disc fixer
NOTE: this program is SHAREWARE. Read the !SHAREWARE file for more info.
hardfix is a disc utility that fixes the errors that can affect the boot
block, the 2 copies of the map and the root directory without having to scan
the whole directory tree. These sort of errors generally make the disc
un-readable or un-writable!
hardfix can also be used to write the bootblock, map and root directory to a
file, so that you can always try to restore them in case they are totally
damaged (ie. absolutely unfixable).
Index
-----
- Usage
- When you need to use it
- The fixable errors
- The logfile
- Notes
- Extra features
- Saved file format
- Disclaimer
- Limitations
- Bugs
- Results achieved up to now
- History
- Credits
- Conditions of use
- Contacting the Author
Usage
-----
hardfix [-options] [-[s|r] savefile] [-l logfile] pathname
-l print the results in "logfile"
-s save bootblock/map/root sectors to "savefile"
-r restore bootblock/map/root sectors from "savefile"
-Q ask before fixing
-1/-2 force to fix the first/second copy of the map
If the disc is readable, pathname can contain the disc name (eg.
IDEFS::IDEDisc4.$), otherwise it must contain the disc number (eg.
IDEFS::4.$).
When you need to use it
-----------------------
hardfix should not be used regularly like fsck, since the errors it fixes are
usually really uncommon. Moreover fsck recognises most of the errors hardfix
cures and tells you when it is needed.
Anyway, you can use it regularly to save the important disc data (ie.
bootblock, map and root) to a file, so that you will be able to restore them
if they are completely destroyed for some mysterious reason. Moreover, you
are adviced to save them before trying to fix the map with fsck or with
hardfix itself: if the fix is wrong (especially if it aggravates the
situation!), you can always restore your old data.
Remember that restoring old maps generally causes many file corruptions! In
fact, the map is costantly updated while files are saved/deleted, and even
files that are not updated can be automatically moved around by RISC OS.
If your map is broken, try to fix it with fsck and hardfix and eventually
restore an old one only if you are sure there is nothing better to do!
The fixable errors
------------------
hardfix is able to fix the following errors:
- bootblock checksum wrong
- bootblock defect list end marker missing
- bootblock defect list checksum wrong
- map cross check wrong
- map copies different
- zone checksum wrong (this is the typical cause of unreadable discs)
- zone free chunk offset wrong
- zone free linked list wrong (this is the typical cause of unwritable discs)
- zone not correctly terminated
- ID too high for the disc shape
- not sector-aligned object
- last object in zone too long
- illegal system files
- root directory identifiers wrong
- root checksum wrong
- root master sequence numbers different
- root endmarker wrong
- root reserved bytes not cleared
- root address wrong
The bootblock errors should never appear, unless your disc is *really*
damanged or badly formatted, and will probably be useless to try to fix it.
Moreover it seems that some some disc have been made completely unreadable
after hardfix 'cured' the bootblock checksum (anyway, reformatting and
restoring the map and the root directory using hardfix fixed everything!).
Considering this bad experience I removed the possibility to save the
bootblock from the unregistered version. If you really need it (for example
because the disc is unreadable due to bootblock corrupton) you *must* contact
me (sending the saved disc data) and I will try to investigate. In old
versions of this file I said "you *should* contact the author" but someone
didn't and...
The map errors are the most common, especially the ones about free lists, but
can usually be successfully cured.
The root directory errors are generally serious since they usually imply that
the directory has been completely overwritten. In this case the only choice
is to restore it from a previously saved file (only the root should be
restored, not the bootblock and map, too!).
Using the -Q option you will be asked to choose if the error(s) has to be
fixed or left intact. So you can choose to fix only the map and not the
bootblock, for example.
You will always be asked if the fixes has to be applied to the disc (ie. if
you really want to save the fixed bootblock, map and root directory).
The logfile
-----------
Using the logfile (-l) option is generally really useful: if something
strange happens, the author will be more helpful if he can see exactly what
happened and you don't even have to try to explain what happened when you run
hardfix, the logfile and the saved disc data is usually enough!
The logfile contains exactly what it is printed to the screen, so it should
be really small (nearly 1K on a good disc or nearly 5K on a quite corrupted
one).
You cannot save the logfile to the disc to fix!
If a file with the same name of the logfile already exists, the new data will
be attached at the end of it: in this way, you can attach together two or
more logfiles.
Notes
-----
If the two copies of the map are different, hardfix tries to fix the less
damaged. If they are apparently damaged at the same level, hardfix will ask
you which map to fix. In normal cases, you are adviced to fix the map that
hardfix suggests or, by default, choose the first one.
The -1 and -2 options can be used to force hardfix to try to fix the first or
the second copy, regardless of their state.
Gordian Installer (a commercial protection system) modifies the map creating
some unofficial system file (strictly speaking, the only system files allowed
on E-Format discs are the bootblock, the map and the root directory). hardfix
detects this corruption but always asks you if you want to fix it: if you
have a Gordian protected program installed on the disc you must not fix this
problem, otherwise it will no longer run and you will need a new installation
floppy.
Extra features
--------------
Registered versions fully support 'big' discs (ie discs larger than 512Mb
supported by the new FileCore module for RISC OS 3.60 or later) while the
unregistered version will only show if there are problems but will not save
the fixed data back to the disc.
A special features code is available to allow hardfix to write to the
bootblock. Since this may be dangerous I'll not usually allow people to use
this code (unless they need it in order to fix their disc).
Saved file format
-----------------
This is only of interest to people who wants to access to the saved file in
their own programs (probably nobody!).
The saved file has a header that contains the filesystem informations
followed by a series of tagged object.
The header consists of the filesystem name followed by a newline and then the
disc number followed by another newline.
Each tagged object consists of a textual tag of 4 bytes followed by the
object itself. The currently recognised tags are:
"BOOT" - bootblock (512 bytes)
"MAP1" - the first copy of the map (the length can be calculated from the
bootblock data)
"MAP2" - the second copy of the map (the same length as the first copy)
"ROOT" - the root directory (2048 bytes)
"RSiX" - the RISCiX partition table (only if RISCiX partitioned!) (256 bytes)
The bootblock must always come before the map, otherwise the length of the
map cannot be calculated. Only 800K floppies have no bootblock: in this case
the length of the map is 1024 bytes.
The second copy of the map must always follow the first one.
Any other tag is ignored and the file is scanned until a recognised tag is
found. The tags should be word aligned (the alignement refers to the first
tag even if it isn't actually word aligned inside the file because of the
filesystem name).
Disclaimer
----------
hardfix can be considered a really dangerous program since it can directly
write to the bootblock, map and root directory: these are the key sectors of
a disc, damaging them can result in the complete or partial loss of the data
on the disc.
I tried most of the features of hardfix on my disc and on some floppies but I
cannot be completely sure it will work on your disc, too. Always save the
data using the -s option before trying to fix the disc and remember that it's
generally better not to fix the bootblock (actually it isn't possible with
the unregistered version...).
Anyway, if something goes wrong, I am sorry for you but I AM NOT RESPONSIBLE
for any loss of data on your discs, so use hardfix at your own risk.
Limitations
-----------
I think that hardfix is able to cure almost every 'fixable' error I
experienced: this means that it cannot fix a completely damaged disc (ie. if
both copies of the map are overwritten by some random data it can't do
nothing apart from restoring a saved file). Maybe other types of possible
errors exist, I'll try to add a fix for them as soon as someone will
encounter them.
hardfix cannot join two adjacent free chunks but I don't think this is a
problem. This limitation could be fixed in future versions.
Sometimes, if the map is very corrupted, you will need to run hardfix more
than once for a complete fix.
Bugs
----
hardfix may have problems with RISCiX partitioned drives: if you have such a
drive and if hardfix wants to fix a map that seems to be good (try CheckMap
and fsck on it) don't let it write the map back to disc!
Results achieved up to now
--------------------------
If you run hardfix on your corrupted HD, please let me know! If it wasn't
able to fix it, I'll try to modify it to cope with your problem. If you want
to stay anonymous tell me not to include your name.
Positive results:
1) some 800K ADFS floppy (used during development).
2) my 16Mb IDE that I damaged just to see if hardfix worked on it!
3) 203Mb IDE. Owner: L. Domisse
4) 87Mb SCSI (Lingenuity interface). Owner: S. Kock
5) 327Mb SCSI (Acorn interface). Owner: C. Ghezzi
6) 80Mb SCSI (Lingenuity interface). Owner: N. Bannon
7) many experiments on my 545Mb IDE (Risc PC), so that now RISC OS
recognises it as a 545Mb drive even if only 400Mb are formatted...
I don't think that hardfix will ever have a long list of fixed disc...
Negative results:
1) 116Mb IDE (Desktop Projects interface). Owner: A.D. Hodgkinson
Trying to fix the bootblock (the checksum was wrong, apparently it has
always been wrong...), the disc was made completely unreadable. The
disc was then formatted and hardfix was able to restore the map and the
root directory (so that all the disc content was restored!).
2) 210Mb IDE (Risc PC). Owner: P.B.
Trying to fix the bootblock, the defect list was corrupted and the disc
became completely unreadable/unwritable. This problem no more occurs in
version > 1.00.
I hope that hardfix will never have a long list of failures too!
History
-------
1.00 -- 11 Oct 94
First released version.
1.01 -- 05 Feb 95
Cured a bug that in some case prevented to fix some strange case of lost free
space in some zone. When restoring the map it tries not to read the disc
shape from the disc itself (because it may be corrupted) but uses the saved
one. Removed the possibility to write the bootblock to disc since it could be
dangerous. Added fix of too high ID and not sector-aligned objects. Fixed
some problem with RISCiX partitioned bootblocks and with bad defect list (not
really useful since the ability to fix bootblocks has been removed!). Added
fix of root address and root reserved bytes.
1.02 -- 12 Jun 95
Fixed defect list checksum calculation that was broken if there was only one
defect. Improved handling of non-ADFS partitioned discs.
1.10 -- 03 Jan 96
Added code-based user registration. Added check for last object in zone too
long. Added support for 'big' discs (registered version only).
1.11 -- 22 Dec 96
Fixed a problem that prevented hardfix from running properly with Panasonic
PD drives. Added check and fix for unofficial system files (including a
warning for Gordian Installed programs). The unregistered version now checks
'big' discs but will not eventually fix them.
Credits
-------
I'd like to thank the following people who contibuted in some way to the
development of hardfix (in alphabetical order):
- Laurent Domisse who pushed me to write this program to fix his unreadable
disc (and then unwritable, too!)
- Hans Ole Rafaelsen who tried hardfix on 1.6Mb floppies.
Conditions of use
-----------------
hardfix can only be distributed with the complete fsck suite.
Read the !SHAREWARE file for the conditions of use and distribution of the
whole package.
Contacting the Author
---------------------
Post: Sergio Monesi
Via Trento e Trieste 30
20046 Biassono (MI)
Italy
EMail: msergio@mbox.vol.it
pel0015@cdc8g5.cdc.polimi.it
sergio@freebsd.first.gmd.de
WWW: http://cdc8g5.cdc.polimi.it/~pel0015/